<?php
/**
 * Created by PhpStorm.
 * User: sqq
 * Date: 2018/10/29
 * Time: 13:31
 */
$api_service_path = __DIR__ . "/../../../api/";
ob_start();
require_once($api_service_path . "public/index.php");
ob_end_clean();

echo date('Y-m-d H:i:s',time())." article keyword cancel started \n";

//查询C端所有的订单
$article = ArticleWechat3::all();
if(!is_null($article)){
    foreach($article as $key => $val){
        $keyword_id = array_filter(explode(',',$val->keyword_id));
        if(!empty($keyword_id)){
            foreach($keyword_id as $k){
                $product = new ArticleKeyWordRelationWechat3();
                $product->article_id = $val->id;
                $product->keyword_id = $k;
                $product->status = 1;
                $product->created_at = Common::currentTimeString();
                $product->updated_at = Common::currentTimeString();
                $product->save();
            }
        }
    }
}

echo date('Y-m-d H:i:s',time())." article keyword cancel ended \n";